
from onenet.HttpApi import HttpApi
    
if __name__ == '__main__':
    print('main')

    userId = 'your user id'
    accessKey = 'your access key'
    
    productId= '5POpr2bk2g'
    deviceName = '861658066435903'
    
    groupId = '6adfde33-8e1a-455d-b74c-fafed43862ae'
    
    httApi = HttpApi(userId=userId, accessKey=accessKey)
    result = httApi.queryDeviceDetail(productId=productId, deviceName=deviceName)
    print(result)
    print(result.text)
    
    # result = httApi.deleteDevice(productId=productId, deviceName=deviceName)
    # print(result)
    # print(result.text)

    # result = httApi.createDevice(productId=productId, deviceName=deviceName, desc='create from api')
    # print(result)
    # print(result.text)
        
    # result = httApi.groupAddDevice(groupId=groupId, productId=productId, deviceNames=[deviceName])
    # print(result)
    # print(result.text)
    
    # result = httApi.groupRemoveDevice(groupId=groupId, productId=productId, deviceNames=[deviceName])
    # print(result)
    # print(result.text)
    
    # result = httApi.setDeviceProperty(productId=productId, deviceName=deviceName,  propertyNameValues={'asr':0})
    # print(result)
    # print(result.text)
    
    # result = httApi.queryDeviceProperty(productId=productId, deviceName=deviceName,  propertyNames= ['asr'])
    # print(result)
    # print(result.text)
    
    # result = httApi.callDeviceService(productId=productId, deviceName=deviceName,  serviceName='tts_play_cmd', serviceParams={'utf8_text' : '这是测试'})
    # print(result)
    # print(result.text)
    
    result = httApi.moveDevice(productId=productId, targetUser='13810314817', deviceNames=[deviceName])
    print(result)
    print(result.text)
    
    
    
    print("exit")
    
    
    
    
    